<title><?= $sf_response->getTitle() ?></title>
<td>
    <?php
    if ($po->getApprovalstatus() == CommonValues::$gMRApprovalStatus['key']['Initial'])
    	echo link_to($po->getPono() ? $po->getPono() : __('-'), 'po/edit?id='.$po->getId()) ;
    else if  ($po->getApprovalstatus() == CommonValues::$gMRApprovalStatus['key']['Cancel'])
    	echo link_to($po->getPono() ? $po->getPono() : __('-'), 'po/edit?id='.$po->getId(), array('confirm' => __('Are you sure you want to edit this canceled PO?'))) ;
    else if  ($po->getApprovalstatus() == CommonValues::$gMRApprovalStatus['key']['Rejected'])
        echo link_to($po->getPono() ? $po->getPono() : __('-'), 'po/edit?id='.$po->getId(), array('confirm' => __('Are you sure you want to edit this rejected PO?'))) ;
    else echo $po->getPono();
    ?></td>
    <td><?php 
        $value = '';
        $MRobject = null;
        if ($po->getMrno()) {
            if ($po->getCompcategory() ==CommonValues::$gCompCategory['key']['Main Component']) 
                $MRobject = MRPeer::retrieveByPK($po->getMrno());
            elseif ($po->getCompcategory() ==CommonValues::$gCompCategory['key']['Sub Component']) 
                $MRobject = MR2Peer::retrieveByPK($po->getMrno());
            else 
                $MRobject = MR3Peer::retrieveByPK($po->getMrno());
            if ($MRobject){
                $value = $MRobject->getMrno();
                if ($po->getCompcategory() ==CommonValues::$gCompCategory['key']['Main Component']){
                    $bom = BOMPeer::retrieveByPK($MRobject->getBomId());
                    $value.=':'.$bom->getWono();
                }
            }

        }
    echo $value ?></td>
      <td><?php echo CommonValues::$gMRCategory['value'][$po->getCategory()] ?></td>
      <td><?php echo $po->getProject() ?></td>
      <td><?php echo ($po->getExparrdate() !== null && $po->getExparrdate() !== '') ? format_date($po->getExparrdate(), "D") : '' ?></td>
      <td><?php echo $po->getPaymentterm()? $po->getPaymentterm(): '-'?></td>
      <td><?php echo $po->getSupplier() ?></td>
      <td><?php echo CommonValues::$gPOShip['value'][$po->getShippedvia()] ?></td>
      <td><?php echo CommonValues::$gPOType['value'][$po->getType()] ?></td>
      <td><?php echo ($po->getCreatedAt() !== null && $po->getCreatedAt() !== '') ? format_date($po->getCreatedAt(), "D") : '' ?></td>
      <td><?php echo link_to($po->getComponentgroupId() ? image_tag('/sf/sf_admin/images/list.png', array('alt' => 'List', 'title' => 'List')):  __('-'), 'component/SLListPOGroup?code='.$po->getPono().'&componentgroup_id='.$po->getComponentgroupId().'&Authentication=VIEW_PO&backURL=po~1list~2id~4'.$po->getId()) ?></td>
      <td><?php $user = sfGuardUserPeer::retrieveByPK($po->getUserId()); echo $user? $user->getFullname(): ''?></td>
      <td><?php echo CommonValues::$gMRApprovalStatus['value'][$po->getApprovalstatus()] ?></td>
      <td><?php echo CommonValues::$gPOReceivedStatus['value'][$po->getReceivedstatus() ]?></td>
      
  